package battleModel;

import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;

/**
 * This is the missile shot from a turret. Slope keeps track of the current slope
 * this would only change after a bounce.
 * Obstacle Attributes:
 *     health=1, damageable=false, location=in constructor, image=in constructor
 * Other attributes:
 *     slope=in constructor, damage=50, bounced=false, exploded=false;
 */
public class Missile extends Obstacle{

	private Perimeter perimeter;
	private int damage;
	private double slope;
	private boolean bounced, exploded;
	private AffineTransform affine;
	
	public Missile(Image i, double slope, AffineTransform turretAffine) {
		super(1, false, new Point((int)turretAffine.getTranslateX(), (int)turretAffine.getTranslateY()), i);
		this.slope=slope;
		damage=50;
		bounced=false;
		exploded=false;
		
		perimeter=new Perimeter(15,4,19,11);
		
		affine=new AffineTransform();
		affine.translate(31.5+15, 30.5-4);
		affine.preConcatenate(turretAffine);
	}
	
	public int getDamage(){
		return damage;
	}

	public double getSlope(){
		return slope;
	}
	
	public AffineTransform getAffine(){
		return affine;
	}
	
	public boolean hasBounced(){
		return bounced;
	}
	
	public boolean hasExploded(){
		return exploded;
	}
	 
	public void setSlope(double slope){
		this.slope=slope;
	}
	
	public void setBounced(boolean bool){
		bounced=bool;
	}
	
	public void setExploded(boolean bool){
		exploded=bool;
	}

	@Override
	public Shape getCollisionShape() {
		return perimeter.getRect();
	}
}
